package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountUserProfileSecurityRoleTabPageUtil extends SeleniumPageUtil {
	
	// Security Role
	public final static By UPSR_SPAN_SECURITY_ROLE_HEADER = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_Header_lblHeader");
	public final static By UPSR_IMG_SECURITY_ROLE_PREFERENCES = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_Header_imgPreferences");
	public final static By UPSR_IMG_SECURITY_ROLE_EXPORT_TO_EXCEL = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_Header_imgExcelExport");
	public final static By UPSR_LBL_SECURITY_ROLE_PAGE = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[1]");
	public final static By UPSR_LBL_SECURITY_ROLE_PAGE_NO = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_lblPagingPageNumber");
	public final static By UPSR_LBL_SECURITY_ROLE_PAGE_OF = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[2]/tbody/tr/td[3]");
	public final static By UPSR_LBL_SECURITY_ROLE_PAGE_COUNT = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_lblPagingPageCount");
	public final static By UPSR_IMG_SECURITY_ROLE_FIRST = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_imgFirst");
	public final static By UPSR_IMG_SECURITY_ROLE_PREVIOUS = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_imgPrevious");
	public final static By UPSR_IMG_SECURITY_ROLE_NEXT = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_imgNext");
	public final static By UPSR_IMG_SECURITY_ROLE_LAST = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_PagingTop_imgLast");
	public final static By UPSR_IMG_SECURITY_ROLE_SECURITY_ROLE_FILTER_0 = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_filter_0\r\n            ");
	public final static By UPSR_IMG_SECURITY_ROLE_FILTER_1 = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_filter_1\r\n            ");
	public final static By UPSR_TH_SECURITY_ROLE_USER_ROLE = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_sort_0\r\n          ");
	public final static By UPSR_TH_SECURITY_ROLE_DESCRIPTION = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_UserRoleReport_sort_1\r\n          ");

	// Authorized Customers
	public final static By UPSR_SPAN_AUTHORIZED_CUSTOMERS_HEADER = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_Header_lblHeader");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_PREFERENCES = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_Header_imgPreferences");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_EXPORT_TO_EXCEL = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_Header_imgExcelExport");
	public final static By UPSR_LBL_AUTHORIZED_CUSTOMERS_PAGE = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[6]/tbody/tr/td[1]");
	public final static By UPSR_LBL_AUTHORIZED_CUSTOMERS_PAGE_NO = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_lblPagingPageNumber");
	public final static By UPSR_LBL_AUTHORIZED_CUSTOMERS_PAGE_OF = By.xpath("//*[@id='ctl44_ParentChildContainer_PnlChildControl']/table[6]/tbody/tr/td[3]");
	public final static By UPSR_LBL_AUTHORIZED_CUSTOMERS_PAGE_COUNT = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_lblPagingPageCount");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_FIRST = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_imgFirst");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_PREVIOUS = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_imgPrevious");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_NEXT = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_imgNext");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_LAST = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_PagingTop_imgLast");
	public final static By UPSR_IMG_AUTHORIZED_CUSTOMERS_FILTER_0 = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_filter_0\r\n            ");
	public final static By UPSR_TH_AUTHORIZED_CUSTOMERS_CUSTOMER = By.id("ctl44_ParentChildContainer_UserProfile_SecurityRole1_AuthorizedCustomers_sort_0\r\n          ");

	public static void enterUserProfileSecurityRolePage(){
		SpYAccountUserProfileDefaultPageUtil.enterYourAccountUserProfileDefaultPage();
		SeleniumUtil.waitForFixedMilliseconds(1000);
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountUserProfileDefaultPageUtil.YAUP_TAB_SECURITY_ROLE));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				UPSR_IMG_SECURITY_ROLE_PREFERENCES, UPSR_IMG_SECURITY_ROLE_EXPORT_TO_EXCEL, UPSR_IMG_SECURITY_ROLE_FIRST, UPSR_IMG_SECURITY_ROLE_PREVIOUS, UPSR_IMG_SECURITY_ROLE_NEXT,
				UPSR_IMG_SECURITY_ROLE_LAST, UPSR_IMG_SECURITY_ROLE_SECURITY_ROLE_FILTER_0, UPSR_IMG_SECURITY_ROLE_FILTER_1, UPSR_IMG_AUTHORIZED_CUSTOMERS_PREFERENCES,
				UPSR_IMG_AUTHORIZED_CUSTOMERS_EXPORT_TO_EXCEL, UPSR_IMG_AUTHORIZED_CUSTOMERS_FIRST, UPSR_IMG_AUTHORIZED_CUSTOMERS_PREVIOUS, UPSR_IMG_AUTHORIZED_CUSTOMERS_NEXT,
				UPSR_IMG_AUTHORIZED_CUSTOMERS_LAST, UPSR_IMG_AUTHORIZED_CUSTOMERS_FILTER_0
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_EXPORT_TO_EXCEL));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_SECURITY_ROLE_FILTER_0));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_SECURITY_ROLE_FILTER_1));
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_EXPORT_TO_EXCEL));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(UPSR_IMG_AUTHORIZED_CUSTOMERS_FILTER_0));
	}
}
